w->shortname = cet_convert_string(wpt->shortname);
w->description = cet_convert_string(wpt->description);
w->notes = cet_convert_string(wpt->notes);
- w->url = cet_convert_string(wpt->url);
- w->url_link_text = cet_convert_string(wpt->url_link_text);
+
+ const char*url = cet_convert_string(wpt->url);
+ const char*url_link_text = cet_convert_string(wpt->url_link_text);
+ w->url = url;
+ w->url_link_text = url_link_text;
+ xfree(url);
+ xfree(url_link_text);
+
for (url_next = w->url_next; url_next; url_next = url_next->url_next) {
url_next->url = cet_convert_string(url_next->url);
url_next->url_link_text = cet_convert_string(url_next->url_link_text);
}
if (gc_data) {
- gc_data->placer = cet_convert_string(gc_data->placer);
- gc_data->hint = cet_convert_string(gc_data->hint);
+ const char *placer = cet_convert_string(gc_data->placer);
+ const char *hint = cet_convert_string(gc_data->hint);
+ gc_data->placer = placer;
+ gc_data->hint = hint;
+ xfree(placer);
+ xfree(hint);
}
fs = wpt->fs;
rte->rte_name = cet_convert_string(route->rte_name);
rte->rte_desc = cet_convert_string(route->rte_desc);
- rte->rte_url = cet_convert_string(route->rte_url);
+ const char*rte_url = cet_convert_string(route->rte_url);
+ rte->rte_url = rte_url;
+ xfree(rte_url);
}
/* cet_convert_route_tlr: internal used within cet_convert_strings process */
}
break;
case 17:
- wpt->url = DUPSTR(str);
+ wpt->url = str;
break;
case 18:
GMSD_SET(category, parse_categories(str));
s = xstrrstr(wpt_tmp->description, " by ");
if (s) {
waypt_alloc_gc_data(wpt_tmp);
- wpt_tmp->gc_data->placer = xstrdup(s + 4);
+ wpt_tmp->gc_data->placer = QString(s + 4);
if (nuke_placer) {
// Sleaze alert. We're casting away constness and writing into a string
const char** avp = &attrv[0];
while (*avp) {
if (0 == strcmp(avp[0], "text")) {
- wpt_tmp->url_link_text = xstrdup(avp[1]);
+ wpt_tmp->url_link_text = avp[1];
}
avp+=2;
}
}
void wpt_link(const char* args, const char** attrv)
{
- wpt_tmp->url = xstrdup(args);
+ wpt_tmp->url = args;
}
void wpt_type(const char* args, const char** unused)
result = geoniche_icon_map[i];
}
}
- if (result != NULL) {
- result = xstrdup(result);
- }
return result;
}
case tt_cache_hint:
rtrim(cdatastrp);
if (cdatastrp[0]) {
- waypt_alloc_gc_data(wpt_tmp)->hint = xstrdup(cdatastrp);
+ waypt_alloc_gc_data(wpt_tmp)->hint = cdatastrp;
}
break;
case tt_cache_desc_long:
if (cdatastrp[0]) {
geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
gc_data->desc_long.is_html = cache_descr_is_html;
- gc_data->desc_long.utfstring = xstrdup(cdatastrp);
+ gc_data->desc_long.utfstring = cdatastrp;
}
break;
case tt_cache_desc_short:
if (cdatastrp[0]) {
geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
gc_data->desc_short.is_html = cache_descr_is_html;
- gc_data->desc_short.utfstring = xstrdup(cdatastrp);
+ gc_data->desc_short.utfstring = cdatastrp;
}
break;
case tt_cache_terrain:
waypt_alloc_gc_data(wpt_tmp)->terr = x * 10;
break;
case tt_cache_placer:
- waypt_alloc_gc_data(wpt_tmp)->placer = xstrdup(cdatastrp);
+ waypt_alloc_gc_data(wpt_tmp)->placer = cdatastrp;
break;
case tt_cache_log_date:
gc_log_date = xml_parse_time(cdatastrp);
case tt_wpt_url:
case tt_trk_trkseg_trkpt_url:
case tt_rte_rtept_url:
- wpt_tmp->url = xstrdup(cdatastrp);
+ wpt_tmp->url = cdatastrp;
break;
case tt_wpt_urlname:
case tt_trk_trkseg_trkpt_urlname:
case tt_rte_rtept_urlname:
- wpt_tmp->url_link_text = xstrdup(cdatastrp);
+ wpt_tmp->url_link_text = cdatastrp;
break;
case tt_wpt_link:
//TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link:
static gbfile* ofd;
static waypoint* wpt_tmp;
-char* urllink, *urllinkt;
+QString urllink;
+QString urllinkt;
static char* binary = NULL;
#define MYNAME "lmx"
static void
lmx_lm_mlink_s(const char* args, const char** unused)
{
- urllink = urllinkt = NULL;
+ urllink = urllinkt = QString();
}
static void
lmx_lm_link(const char* args, const char** unused)
{
- urllink = xstrdup(args);
+ urllink = args;
}
static void
lmx_lm_linkt(const char* args, const char** unused)
{
- urllinkt = xstrdup(args);
+ urllinkt = args;
}
static void
wpt_tmp->description = xstrdup(s);
break;
case 10:
- gcdata->placer = xstrdup(s);
+ gcdata->placer = s;
break;
case 11:
- gcdata->hint = xstrdup(s);
+ gcdata->hint = s;
break;
case 12: // cache type
if (strcmp(s, "Mystery Cache") == 0) {
} else if (0 == strcmp(ap[0], "name")) {
wpt_tmp->description = xstrdup(ap[1]);
} else if (0 == strcmp(ap[0], "user_name")) {
- gc_data->placer = xstrdup(ap[1]);
+ gc_data->placer = ap[1];
} else if (0 == strcmp(ap[0], "latitude")) {
sscanf(ap[1], "%lf",
&wpt_tmp->latitude);
gc_data->container = nc_mkcont(ap[1]);
} else if (0 == strcmp(ap[0], "description")) {
gc_data->desc_long.is_html = 1;
- gc_data->desc_long.utfstring = xstrdup(ap[1]);
+ gc_data->desc_long.utfstring = ap[1];
} else if (0 == strcmp(ap[0], "comments")) {
gc_data->desc_short.is_html = 1;
- gc_data->desc_short.utfstring = xstrdup(ap[1]);
+ gc_data->desc_short.utfstring = ap[1];
}
}
waypt_add(wpt_tmp);
holder = csv_stringtrim(s, "", 0);
if (strstr(holder, "http:") != NULL) {
wpt_tmp->url = holder;
- } else {
- xfree(holder);
- }
+ }
+ xfree(holder);
break;
default:
/* whoa! nelly */
}
break;
case fld_gc_placer:
- gc_data->placer = xstrdup(s);
+ gc_data->placer = s;
break;
case fld_gc_placer_id:
gc_data->placer_id = atoi(s);
break;
case fld_gc_hint:
- gc_data->hint = xstrdup(s);
+ gc_data->hint = s;
break;
default: